home *** CD-ROM | disk | FTP | other *** search
- #include <Global.h>
-
- #define FIRSTID 1000
- #define SECONDID 1001
-
- short updates;
-
- main()
- {
- void initialize(void);
-
- WindowPtr firstWindow, secondWindow;
- EventRecord theEvent;
- Str255 str;
- Rect showRect;
-
- initialize();
- firstWindow = GetNewWindow(FIRSTID, NULL, -1);
- SetPort(firstWindow);
- MoveTo(20, 20);
- DrawString("\pUpdate Events:");
- SetRect(&showRect,120, 10, 170, 20);
- secondWindow = GetNewWindow(SECONDID, NULL, -1);
- while (true) {
- if (GetNextEvent(everyEvent, &theEvent));
- if (theEvent.what == updateEvt) {
- updates++;
- BeginUpdate(theEvent.message);
- EndUpdate(theEvent.message);
- }
- if (theEvent.what == keyDown)
- break;
- NumToString(updates, &str);
- EraseRect(&showRect);
- MoveTo(120, 20);
- DrawString(str);
- }
- }
-
- void initialize(void)
- {
- InitGraf(&thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- FlushEvents( everyEvent, 0 );
- }